import java.util.Locale;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-11-30
 * Time: 22:20
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        System.out.println(isPalindrome(s));
    }

    public static boolean isValidChar(char ch){
        if ((ch>='a' && ch<='z')||(ch>='0'&&ch<='9')){
            int i = 0;
            return true;
        }
        return false;
    }

    public static boolean isPalindrome(String s) {
        s = s.toLowerCase();
        int left = 0;
        int right = s.length() - 1;
        while(left < right){
            //从左侧找到一个有效的字符
            while(left<right && !isValidChar(s.charAt(left))){
                left++;
            }
            //从右侧找一个有效的字符
            while (left<right && !isValidChar(s.charAt(right))){
                right--;
            }

            if (s.charAt(left)!=s.charAt(right)){
                return false;
            }
            else {
                left++;
                right--;
            }
        }
        return true;

    }
}
